/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entidades;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 *
 * @author Oswl_C
 */
@Entity
@Table(name = "resp_alternativas", catalog = "lecturadb", schema = "")
@NamedQueries({
    @NamedQuery(name = "RespAlternativas.findAll", query = "SELECT r FROM RespAlternativas r"),
    @NamedQuery(name = "RespAlternativas.findByRalCodigo", query = "SELECT r FROM RespAlternativas r WHERE r.ralCodigo = :ralCodigo"),
    @NamedQuery(name = "RespAlternativas.findByIteCodigo", query = "SELECT r FROM RespAlternativas r WHERE r.iteCodigo = :iteCodigo"),
    @NamedQuery(name = "RespAlternativas.findByRalRespAlt", query = "SELECT r FROM RespAlternativas r WHERE r.ralRespAlt = :ralRespAlt"),
    @NamedQuery(name = "RespAlternativas.findByRalTipo", query = "SELECT r FROM RespAlternativas r WHERE r.ralTipo = :ralTipo")})
public class RespAlternativas implements Serializable {
    @Transient
    private PropertyChangeSupport changeSupport = new PropertyChangeSupport(this);
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "RAL_CODIGO")
    private Integer ralCodigo;
    @ManyToOne
    @JoinColumn(name = "ITE_CODIGO")
    private ItemTest iteCodigo;
    @Column(name = "RAL_RESP_ALT")
    private String ralRespAlt;
    @Column(name = "RAL_TIPO")
    private Character ralTipo;

    public RespAlternativas() {
    }

    public RespAlternativas(Integer ralCodigo) {
        this.ralCodigo = ralCodigo;
    }

    public Integer getRalCodigo() {
        return ralCodigo;
    }

    public void setRalCodigo(Integer ralCodigo) {
        Integer oldRalCodigo = this.ralCodigo;
        this.ralCodigo = ralCodigo;
        changeSupport.firePropertyChange("ralCodigo", oldRalCodigo, ralCodigo);
    }

    public ItemTest getIteCodigo() {
        return iteCodigo;
    }

    public void setIteCodigo(ItemTest iteCodigo) {
        ItemTest oldIteCodigo = this.iteCodigo;
        this.iteCodigo = iteCodigo;
        changeSupport.firePropertyChange("iteCodigo", oldIteCodigo, iteCodigo);
    }

    public String getRalRespAlt() {
        return ralRespAlt;
    }

    public void setRalRespAlt(String ralRespAlt) {
        String oldRalRespAlt = this.ralRespAlt;
        this.ralRespAlt = ralRespAlt;
        changeSupport.firePropertyChange("ralRespAlt", oldRalRespAlt, ralRespAlt);
    }

    public Character getRalTipo() {
        return ralTipo;
    }

    public void setRalTipo(Character ralTipo) {
        Character oldRalTipo = this.ralTipo;
        this.ralTipo = ralTipo;
        changeSupport.firePropertyChange("ralTipo", oldRalTipo, ralTipo);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (ralCodigo != null ? ralCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RespAlternativas)) {
            return false;
        }
        RespAlternativas other = (RespAlternativas) object;
        if ((this.ralCodigo == null && other.ralCodigo != null) || (this.ralCodigo != null && !this.ralCodigo.equals(other.ralCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return ralRespAlt;
    }

    public void addPropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.addPropertyChangeListener(listener);
    }

    public void removePropertyChangeListener(PropertyChangeListener listener) {
        changeSupport.removePropertyChangeListener(listener);
    }
    
}
